www.gusucode.com > VC++ 汽配销售管理系统(Access)源码程序 > VC++ 汽配销售管理系统(Access)源码程序/源码/qpglxt.cpp
//Download by http://www.NewXing.com // qpglxt.cpp : Defines the class behaviors for the application. // #include "stdafx.h" #include "DllHeader.h" #include "qpglxt.h" #include "MainFrm.h" #include "MyDoc.h" #include "MyView.h" #include "DLOGIN.h" #ifdef _DEBUG #define new DEBUG_NEW #undef THIS_FILE static char THIS_FILE[] = __FILE__; #endif ///////////////////////////////////////////////////////////////////////////// // CQpglxtApp BEGIN_MESSAGE_MAP(CQpglxtApp, CWinApp) //{{AFX_MSG_MAP(CQpglxtApp) // NOTE - the ClassWizard will add and remove mapping macros here. // DO NOT EDIT what you see in these blocks of generated code! //}}AFX_MSG_MAP // Standard file based document commands ON_COMMAND(ID_FILE_NEW, CWinApp::OnFileNew) ON_COMMAND(ID_FILE_OPEN, CWinApp::OnFileOpen) // Standard print setup command ON_COMMAND(ID_FILE_PRINT_SETUP, CWinApp::OnFilePrintSetup) END_MESSAGE_MAP() ///////////////////////////////////////////////////////////////////////////// // CQpglxtApp construction CQpglxtApp::CQpglxtApp() { // TODO: add construction code here, // Place all significant initialization in InitInstance } ///////////////////////////////////////////////////////////////////////////// // The one and only CQpglxtApp object CQpglxtApp theApp; CString OP; HINSTANCE hInstance; RxADO ado; PrintStruct m_ps; ///////////////////////////////////////////////////////////////////////////// // CQpglxtApp initialization BOOL CQpglxtApp::InitInstance() { AfxEnableControlContainer(); //载入动态库 hInstance =LoadLibrary("RxDLL.dll"); //载入RXDLL中的函数 MoneyToChineseCode=(_MoneyToChineseCode*)GetProcAddress(hInstance,"MoneyToChineseCode"); CTimeToCString=(_CTimeToCString*)GetProcAddress(hInstance,"CTimeToCString"); CStringTOCTime=(_CStringTOCTime*)GetProcAddress(hInstance,"CStringTOCTime"); Padl=(_Padl*)GetProcAddress(hInstance,"Padl"); CharToLetterCode=(_CharToLetterCode*)GetProcAddress(hInstance,"CharToLetterCode"); if(ado.SetConnection("uid=admin;pwd=111;DRIVER={Microsoft Access Driver (*.mdb)};DBQ=qpglxt.mdb;")==false) return false; cnn=ado.GetConnection(); #ifdef _AFXDLL Enable3dControls(); // Call this when using MFC in a shared DLL #else Enable3dControlsStatic(); // Call this when linking to MFC statically #endif SetRegistryKey(_T("Local AppWizard-Generated Applications")); LoadStdProfileSettings(); // Load standard INI file options (including MRU) CSingleDocTemplate* pDocTemplate; pDocTemplate = new CSingleDocTemplate( IDR_MAINFRAME, RUNTIME_CLASS(CMyDoc), RUNTIME_CLASS(CMainFrame), // main SDI frame window RUNTIME_CLASS(CMyView)); AddDocTemplate(pDocTemplate); CDLOGIN dlg; dlg.DoModal(); return TRUE; } void CQpglxtApp::Print() { CQpglxtApp* app=(CQpglxtApp*)AfxGetApp(); main_wnd=app->m_pMainWnd; app->m_pDocManager->OnFileNew(); } CString CQpglxtApp::ShowPath() { CString ReturnPach; TCHAR szPath[_MAX_PATH]; BROWSEINFO bi; bi.hwndOwner=NULL; bi.pidlRoot=NULL; bi.lpszTitle=_T("请选择一个文件夹"); bi.pszDisplayName=szPath; bi.ulFlags=BIF_RETURNONLYFSDIRS; bi.lpfn=NULL; bi.lParam=NULL; LPITEMIDLIST pItemIDList=SHBrowseForFolder(&bi); if(pItemIDList) { if(SHGetPathFromIDList(pItemIDList,szPath)) ReturnPach=szPath; } else ReturnPach=""; return ReturnPach; } int CQpglxtApp::ExitInstance() { FreeLibrary(hInstance); return CWinApp::ExitInstance(); }